{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](https://pptwinpics.oss-cn-beijing.aliyuncs.com/CDA%E8%AE%B2%E5%B8%88%E6%B0%B4%E5%8D%B0_20200314161940.png)\n",
    "\n",
    "# CDA 免费直播课-Python 基础\n",
    "\n",
    "## 自我介绍\n",
    "\n",
    "大家好，我是 CDA 曹鑫。\n",
    "\n",
    "代码和学习资料：https://github.com/imcda\n",
    "\n",
    "学习小组：http://edu.cda.cn/group/19\n",
    "\n",
    "\n",
    "## 课程前瞻\n",
    "\n",
    "### 主课程：（1h）\n",
    "- 为什么要学 Python？\n",
    "    - 最好的编程语言\n",
    "- Python 安装\n",
    "    - Anaconda 的安装\n",
    "- Python 环境和包的管理\n",
    "    - Conda 的使用\n",
    "- Python 编程工具\n",
    "    - Jupyter Notebook 的使用\n",
    "    \n",
    "### 附加课：\n",
    "- Sublime Text 的安装：https://www.sublimetext.com/\n",
    "- Pycharm 的安装：https://www.jetbrains.com/pycharm/download/#section=mac"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 为什么学 Python？\n",
    "\n",
    "**小组话题:** http://edu.cda.cn/group/19/thread/93\n",
    "\n",
    "## Python 评分最高\n",
    "\n",
    "http://pypl.github.io/PYPL.html\n",
    "\n",
    "## Python 能做的事情很多\n",
    "\n",
    "### 数据抓取\n",
    "\n",
    "你可以利用 Python 爬虫。\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>rank_num</th>\n",
       "      <th>movie_name</th>\n",
       "      <th>actors</th>\n",
       "      <th>release_time</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>霸王别姬</td>\n",
       "      <td>主演：张国荣,张丰毅,巩俐</td>\n",
       "      <td>上映时间：1993-07-26</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>肖申克的救赎</td>\n",
       "      <td>主演：蒂姆·罗宾斯,摩根·弗里曼,鲍勃·冈顿</td>\n",
       "      <td>上映时间：1994-09-10(加拿大)</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>这个杀手不太冷</td>\n",
       "      <td>主演：让·雷诺,加里·奥德曼,娜塔莉·波特曼</td>\n",
       "      <td>上映时间：1994-09-14(法国)</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>罗马假日</td>\n",
       "      <td>主演：格利高里·派克,奥黛丽·赫本,埃迪·艾伯特</td>\n",
       "      <td>上映时间：1953-08-20(意大利)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>泰坦尼克号</td>\n",
       "      <td>主演：莱昂纳多·迪卡普里奥,凯特·温丝莱特,比利·赞恩</td>\n",
       "      <td>上映时间：1998-04-03</td>\n",
       "      <td>9.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>乱世佳人</td>\n",
       "      <td>主演：费雯·丽,克拉克·盖博,奥利维娅·德哈维兰</td>\n",
       "      <td>上映时间：1939-12-15(美国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>唐伯虎点秋香</td>\n",
       "      <td>主演：周星驰,巩俐,郑佩佩</td>\n",
       "      <td>上映时间：1993-07-01(中国香港)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>魂断蓝桥</td>\n",
       "      <td>主演：费雯·丽,罗伯特·泰勒,露塞尔·沃特森</td>\n",
       "      <td>上映时间：1940-05-17(美国)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>辛德勒的名单</td>\n",
       "      <td>主演：连姆·尼森,拉尔夫·费因斯,本·金斯利</td>\n",
       "      <td>上映时间：1993-11-30(美国)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>喜剧之王</td>\n",
       "      <td>主演：周星驰,莫文蔚,张柏芝</td>\n",
       "      <td>上映时间：1999-02-13(中国香港)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>11</td>\n",
       "      <td>音乐之声</td>\n",
       "      <td>主演：朱莉·安德鲁斯,克里斯托弗·普卢默,埃琳诺·帕克</td>\n",
       "      <td>上映时间：1965-03-02(美国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>12</td>\n",
       "      <td>天空之城</td>\n",
       "      <td>主演：寺田农,鹫尾真知子,龟山助清</td>\n",
       "      <td>上映时间：1992-05-01</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>13</td>\n",
       "      <td>大闹天宫</td>\n",
       "      <td>主演：邱岳峰,毕克,富润生</td>\n",
       "      <td>上映时间：1965-12-31</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>14</td>\n",
       "      <td>春光乍泄</td>\n",
       "      <td>主演：张国荣,梁朝伟,张震</td>\n",
       "      <td>上映时间：1997-05-17(法国)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>15</td>\n",
       "      <td>剪刀手爱德华</td>\n",
       "      <td>主演：约翰尼·德普,薇诺娜·瑞德,黛安娜·威斯特</td>\n",
       "      <td>上映时间：1990-12-06(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>16</td>\n",
       "      <td>黑客帝国</td>\n",
       "      <td>主演：基努·里维斯,凯瑞-安·莫斯,劳伦斯·菲什伯恩</td>\n",
       "      <td>上映时间：2000-01-14</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>17</td>\n",
       "      <td>指环王3：王者无敌</td>\n",
       "      <td>主演：伊莱贾·伍德,伊恩·麦克莱恩,丽芙·泰勒</td>\n",
       "      <td>上映时间：2004-03-15</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>18</td>\n",
       "      <td>加勒比海盗</td>\n",
       "      <td>主演：约翰尼·德普,凯拉·奈特莉,奥兰多·布鲁姆</td>\n",
       "      <td>上映时间：2003-11-21</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>19</td>\n",
       "      <td>教父2</td>\n",
       "      <td>主演：阿尔·帕西诺,罗伯特·德尼罗,黛安·基顿</td>\n",
       "      <td>上映时间：1974-12-12(美国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>20</td>\n",
       "      <td>楚门的世界</td>\n",
       "      <td>主演：金·凯瑞,劳拉·琳妮,诺亚·艾默里奇</td>\n",
       "      <td>上映时间：1998(罗马尼亚)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>21</td>\n",
       "      <td>无间道</td>\n",
       "      <td>主演：刘德华,梁朝伟,黄秋生</td>\n",
       "      <td>上映时间：2003-09-05</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>22</td>\n",
       "      <td>蝙蝠侠：黑暗骑士</td>\n",
       "      <td>主演：克里斯蒂安·贝尔,希斯·莱杰,阿伦·伊克哈特</td>\n",
       "      <td>上映时间：2008-07-14(阿根廷)</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>23</td>\n",
       "      <td>射雕英雄传之东成西就</td>\n",
       "      <td>主演：张国荣,梁朝伟,张学友</td>\n",
       "      <td>上映时间：1993-02-05(中国香港)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>24</td>\n",
       "      <td>指环王1：护戒使者</td>\n",
       "      <td>主演：伊莱贾·伍德,伊恩·麦克莱恩,丽芙·泰勒</td>\n",
       "      <td>上映时间：2002-04-04</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>25</td>\n",
       "      <td>天堂电影院</td>\n",
       "      <td>主演：菲利浦·诺瓦雷,赛尔乔·卡斯特利托,蒂兹亚娜·罗达托</td>\n",
       "      <td>上映时间：1988-11-17(意大利)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>26</td>\n",
       "      <td>指环王2：双塔奇兵</td>\n",
       "      <td>主演：伊莱贾·伍德,伊恩·麦克莱恩,丽芙·泰勒</td>\n",
       "      <td>上映时间：2003-04-25</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>27</td>\n",
       "      <td>机器人总动员</td>\n",
       "      <td>主演：本·贝尔特,艾丽莎·奈特,杰夫·格尔林</td>\n",
       "      <td>上映时间：2008-06-27(美国)</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>28</td>\n",
       "      <td>活着</td>\n",
       "      <td>主演：葛优,巩俐,牛犇</td>\n",
       "      <td>上映时间：1994-05-17(法国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>29</td>\n",
       "      <td>狮子王</td>\n",
       "      <td>主演：马修·布罗德里克,尼基塔·卡兰姆,詹姆斯·厄尔·琼斯</td>\n",
       "      <td>上映时间：1995-07-15</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>30</td>\n",
       "      <td>拯救大兵瑞恩</td>\n",
       "      <td>主演：汤姆·汉克斯,马特·达蒙,汤姆·塞兹摩尔</td>\n",
       "      <td>上映时间：1998-11-13</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>31</td>\n",
       "      <td>盗梦空间</td>\n",
       "      <td>主演：莱昂纳多·迪卡普里奥,渡边谦,约瑟夫·高登-莱维特</td>\n",
       "      <td>上映时间：2010-09-01</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>32</td>\n",
       "      <td>忠犬八公的故事</td>\n",
       "      <td>主演：Forest,理查·基尔,琼·艾伦</td>\n",
       "      <td>上映时间：2009-06-13(美国)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>33</td>\n",
       "      <td>哈尔的移动城堡</td>\n",
       "      <td>主演：倍赏千惠子,木村拓哉,美轮明宏</td>\n",
       "      <td>上映时间：2004-09-05(意大利)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>34</td>\n",
       "      <td>阿凡达</td>\n",
       "      <td>主演：萨姆·沃辛顿,佐伊·索尔达娜,米歇尔·罗德里格兹</td>\n",
       "      <td>上映时间：2010-01-04</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>35</td>\n",
       "      <td>疯狂原始人</td>\n",
       "      <td>主演：尼古拉斯·凯奇,艾玛·斯通,瑞安·雷诺兹</td>\n",
       "      <td>上映时间：2013-04-20</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>36</td>\n",
       "      <td>十二怒汉</td>\n",
       "      <td>主演：亨利·方达,李·科布,马丁·鲍尔萨姆</td>\n",
       "      <td>上映时间：1957-04-13(美国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>37</td>\n",
       "      <td>搏击俱乐部</td>\n",
       "      <td>主演：爱德华·哈里森·诺顿,布拉德·皮特,海伦娜·伯翰·卡特</td>\n",
       "      <td>上映时间：1999-09-10(意大利)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>38</td>\n",
       "      <td>幽灵公主</td>\n",
       "      <td>主演：松田洋治,石田百合子,田中裕子</td>\n",
       "      <td>上映时间：1998-05-01</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>39</td>\n",
       "      <td>V字仇杀队</td>\n",
       "      <td>主演：娜塔莉·波特曼,雨果·维文,斯蒂芬·瑞</td>\n",
       "      <td>上映时间：2005-12-11(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>40</td>\n",
       "      <td>当幸福来敲门</td>\n",
       "      <td>主演：威尔·史密斯,贾登·史密斯,坦迪·牛顿</td>\n",
       "      <td>上映时间：2008-01-17</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>41</td>\n",
       "      <td>放牛班的春天</td>\n",
       "      <td>主演：热拉尔·朱尼奥,让-巴蒂斯特·莫尼耶,玛丽·布奈尔</td>\n",
       "      <td>上映时间：2004-10-16</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>42</td>\n",
       "      <td>末代皇帝</td>\n",
       "      <td>主演：尊龙,陈冲,彼得·奥图尔</td>\n",
       "      <td>上映时间：1987-10-23</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>43</td>\n",
       "      <td>大话西游之月光宝盒</td>\n",
       "      <td>主演：周星驰,莫文蔚,吴孟达</td>\n",
       "      <td>上映时间：2014-10-24</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>44</td>\n",
       "      <td>风之谷</td>\n",
       "      <td>主演：岛本须美,永井一郎,坂本千夏</td>\n",
       "      <td>上映时间：1992-05</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>45</td>\n",
       "      <td>闻香识女人</td>\n",
       "      <td>主演：阿尔·帕西诺,克里斯·奥唐纳,加布里埃尔·安瓦尔</td>\n",
       "      <td>上映时间：1992-12-23(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>46</td>\n",
       "      <td>三傻大闹宝莱坞</td>\n",
       "      <td>主演：阿米尔·汗,黄渤,卡琳娜·卡普</td>\n",
       "      <td>上映时间：2011-12-08</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>47</td>\n",
       "      <td>勇敢的心</td>\n",
       "      <td>主演：梅尔·吉布森,苏菲·玛索,帕特里克·麦高汉</td>\n",
       "      <td>上映时间：1995-05-18(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>48</td>\n",
       "      <td>速度与激情5</td>\n",
       "      <td>主演：范·迪塞尔,保罗·沃克,道恩·强森</td>\n",
       "      <td>上映时间：2011-05-12</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>49</td>\n",
       "      <td>驯龙高手</td>\n",
       "      <td>主演：杰伊·巴鲁切尔,杰拉德·巴特勒,亚美莉卡·费雷拉</td>\n",
       "      <td>上映时间：2010-05-14</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>50</td>\n",
       "      <td>黑客帝国3：矩阵革命</td>\n",
       "      <td>主演：基努·里维斯,雨果·维文,凯瑞-安·莫斯</td>\n",
       "      <td>上映时间：2003-11-05</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>51</td>\n",
       "      <td>飞屋环游记</td>\n",
       "      <td>主演：爱德华·阿斯纳,乔丹·长井,鲍勃·彼德森</td>\n",
       "      <td>上映时间：2009-08-04</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>52</td>\n",
       "      <td>怦然心动</td>\n",
       "      <td>主演：玛德琳·卡罗尔,卡兰·麦克奥利菲,艾丹·奎因</td>\n",
       "      <td>上映时间：2010-07-26(美国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>53</td>\n",
       "      <td>断背山</td>\n",
       "      <td>主演：希斯·莱杰,杰克·吉伦哈尔,米歇尔·威廉姆斯</td>\n",
       "      <td>上映时间：2005-09-02(意大利)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>54</td>\n",
       "      <td>少年派的奇幻漂流</td>\n",
       "      <td>主演：苏拉·沙玛,伊尔凡·可汗,塔布</td>\n",
       "      <td>上映时间：2012-11-22</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>55</td>\n",
       "      <td>神偷奶爸</td>\n",
       "      <td>主演：史蒂夫·卡瑞尔,杰森·席格尔,拉塞尔·布兰德</td>\n",
       "      <td>上映时间：2010-06-20(俄罗斯)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>56</td>\n",
       "      <td>致命魔术</td>\n",
       "      <td>主演：休·杰克曼,克里斯蒂安·贝尔,迈克尔·凯恩</td>\n",
       "      <td>上映时间：2006-10-17(意大利)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>57</td>\n",
       "      <td>无敌破坏王</td>\n",
       "      <td>主演：约翰·C·赖利,萨拉·西尔弗曼,简·林奇</td>\n",
       "      <td>上映时间：2012-11-06</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>58</td>\n",
       "      <td>鬼子来了</td>\n",
       "      <td>主演：姜文,姜宏波,陈强</td>\n",
       "      <td>上映时间：2000-05-13(法国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>59</td>\n",
       "      <td>美丽心灵</td>\n",
       "      <td>主演：罗素·克洛,詹妮弗·康纳利,艾德·哈里斯</td>\n",
       "      <td>上映时间：2001-12-13(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>60</td>\n",
       "      <td>蝙蝠侠：黑暗骑士崛起</td>\n",
       "      <td>主演：克里斯蒂安·贝尔,迈克尔·凯恩,加里·奥德曼</td>\n",
       "      <td>上映时间：2012-08-27</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>61</td>\n",
       "      <td>甜蜜蜜</td>\n",
       "      <td>主演：黎明,张曼玉,曾志伟</td>\n",
       "      <td>上映时间：2015-02-13</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>62</td>\n",
       "      <td>哈利·波特与死亡圣器（下）</td>\n",
       "      <td>主演：丹尼尔·雷德克里夫,鲁伯特·格林特,艾玛·沃特森</td>\n",
       "      <td>上映时间：2011-08-04</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>63</td>\n",
       "      <td>倩女幽魂</td>\n",
       "      <td>主演：张国荣,王祖贤,午马</td>\n",
       "      <td>上映时间：2011-04-30</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63</th>\n",
       "      <td>64</td>\n",
       "      <td>夜访吸血鬼</td>\n",
       "      <td>主演：汤姆·克鲁斯,布拉德·皮特,克尔斯滕·邓斯特</td>\n",
       "      <td>上映时间：1994-11-11(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>64</th>\n",
       "      <td>65</td>\n",
       "      <td>本杰明·巴顿奇事</td>\n",
       "      <td>主演：布拉德·皮特,凯特·布兰切特,塔拉吉·P·汉森</td>\n",
       "      <td>上映时间：2008-12-25(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>65</th>\n",
       "      <td>66</td>\n",
       "      <td>钢琴家</td>\n",
       "      <td>主演：艾德里安·布洛迪,艾米丽雅·福克斯,米哈乌·热布罗夫斯基</td>\n",
       "      <td>上映时间：2002-05-24(法国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66</th>\n",
       "      <td>67</td>\n",
       "      <td>触不可及</td>\n",
       "      <td>主演：弗朗索瓦·克鲁塞,奥玛·希,安娜·勒尼</td>\n",
       "      <td>上映时间：2011-11-02(法国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>68</td>\n",
       "      <td>小鞋子</td>\n",
       "      <td>主演：默罕默德·阿米尔·纳吉,Kamal Mirkarimi,Behzad Rafi</td>\n",
       "      <td>上映时间：1997(伊朗)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68</th>\n",
       "      <td>69</td>\n",
       "      <td>新龙门客栈</td>\n",
       "      <td>主演：张曼玉,梁家辉,甄子丹</td>\n",
       "      <td>上映时间：2012-02-24</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>69</th>\n",
       "      <td>70</td>\n",
       "      <td>大话西游之大圣娶亲</td>\n",
       "      <td>主演：周星驰,朱茵,莫文蔚</td>\n",
       "      <td>上映时间：2014-10-24</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>71</td>\n",
       "      <td>初恋这件小事</td>\n",
       "      <td>主演：马里奥·毛瑞尔,平采娜·乐维瑟派布恩,阿查拉那·阿瑞亚卫考</td>\n",
       "      <td>上映时间：2012-06-05</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>72</td>\n",
       "      <td>熔炉</td>\n",
       "      <td>主演：孔刘,郑有美,金智英</td>\n",
       "      <td>上映时间：2011-09-22(韩国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>73</td>\n",
       "      <td>素媛</td>\n",
       "      <td>主演：李来,薛耿求,严志媛</td>\n",
       "      <td>上映时间：2013-10-02(韩国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>74</td>\n",
       "      <td>萤火之森</td>\n",
       "      <td>主演：内山昂辉,佐仓绫音,后藤弘树</td>\n",
       "      <td>上映时间：2011-09-17(日本)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>75</td>\n",
       "      <td>穿条纹睡衣的男孩</td>\n",
       "      <td>主演：阿沙·巴特菲尔德,维拉·法梅加,大卫·休里斯</td>\n",
       "      <td>上映时间：2008-08-28(英国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>76</td>\n",
       "      <td>教父</td>\n",
       "      <td>主演：马龙·白兰度,阿尔·帕西诺,詹姆斯·肯恩</td>\n",
       "      <td>上映时间：2015-04-18</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>77</td>\n",
       "      <td>窃听风暴</td>\n",
       "      <td>主演：乌尔里希·穆埃,塞巴斯蒂安·科赫,马蒂娜·格德克</td>\n",
       "      <td>上映时间：2006-03-23(德国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>78</td>\n",
       "      <td>7号房的礼物</td>\n",
       "      <td>主演：柳承龙,郑镇荣,朴信惠</td>\n",
       "      <td>上映时间：2013-01-23(韩国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>79</td>\n",
       "      <td>时空恋旅人</td>\n",
       "      <td>主演：瑞秋·麦克亚当斯,多姆纳尔·格里森,比尔·奈伊</td>\n",
       "      <td>上映时间：2013-09-04(英国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>80</td>\n",
       "      <td>借东西的小人阿莉埃蒂</td>\n",
       "      <td>主演：志田未来,神木隆之介,大竹忍</td>\n",
       "      <td>上映时间：2010-07-17(日本)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>81</td>\n",
       "      <td>恐怖直播</td>\n",
       "      <td>主演：河正宇,李璟荣,李大为</td>\n",
       "      <td>上映时间：2013-07-31(韩国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>82</td>\n",
       "      <td>英雄本色</td>\n",
       "      <td>主演：狄龙,张国荣,周润发</td>\n",
       "      <td>上映时间：2017-11-17</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>83</td>\n",
       "      <td>海豚湾</td>\n",
       "      <td>主演：里克·奥巴瑞,路易·西霍尤斯,哈迪·琼斯</td>\n",
       "      <td>上映时间：2009-07-31(美国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>84</td>\n",
       "      <td>忠犬八公物语</td>\n",
       "      <td>主演：仲代达矢,春川真澄,井川比佐志</td>\n",
       "      <td>上映时间：1987-08-01(日本)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84</th>\n",
       "      <td>85</td>\n",
       "      <td>辩护人</td>\n",
       "      <td>主演：宋康昊,郭度沅,吴达洙</td>\n",
       "      <td>上映时间：2013-12-18(韩国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>86</td>\n",
       "      <td>完美的世界</td>\n",
       "      <td>主演：凯文·科斯特纳,克林特·伊斯特伍德,T·J·劳瑟</td>\n",
       "      <td>上映时间：1993-11-24(美国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>87</td>\n",
       "      <td>上帝之城</td>\n",
       "      <td>主演：亚历桑德雷·罗德里格斯,艾莉丝·布拉加,莱安德鲁·菲尔米诺</td>\n",
       "      <td>上映时间：2002-05-18(戛纳电影节)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>88</td>\n",
       "      <td>美国往事</td>\n",
       "      <td>主演：罗伯特·德尼罗,詹姆斯·伍兹,伊丽莎白·麦戈文</td>\n",
       "      <td>上映时间：2015-04-23</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>89</td>\n",
       "      <td>七武士</td>\n",
       "      <td>主演：三船敏郎,志村乔,千秋实</td>\n",
       "      <td>上映时间：1954-04-26(日本)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>90</td>\n",
       "      <td>一一</td>\n",
       "      <td>主演：吴念真,金燕玲,李凯莉</td>\n",
       "      <td>上映时间：2000-05-15(法国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>91</td>\n",
       "      <td>龙猫</td>\n",
       "      <td>主演：秦岚,糸井重里,岛本须美</td>\n",
       "      <td>上映时间：2018-12-14</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>92</td>\n",
       "      <td>爱·回家</td>\n",
       "      <td>主演：俞承豪,金艺芬,童孝熙</td>\n",
       "      <td>上映时间：2002-04-05(韩国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>93</td>\n",
       "      <td>阿飞正传</td>\n",
       "      <td>主演：张国荣,张曼玉,刘德华</td>\n",
       "      <td>上映时间：2018-06-25</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>94</td>\n",
       "      <td>我爱你</td>\n",
       "      <td>主演：宋在浩,李顺才,尹秀晶</td>\n",
       "      <td>上映时间：2011-02-17(韩国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>95</td>\n",
       "      <td>黄金三镖客</td>\n",
       "      <td>主演：克林特·伊斯特伍德,李·范·克里夫,埃里·瓦拉赫</td>\n",
       "      <td>上映时间：1966-12-23(意大利)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>96</td>\n",
       "      <td>海洋</td>\n",
       "      <td>主演：雅克·贝汉,姜文,兰斯洛特·佩林</td>\n",
       "      <td>上映时间：2011-08-12</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>97</td>\n",
       "      <td>迁徙的鸟</td>\n",
       "      <td>主演：雅克·贝汉,Philippe Labro</td>\n",
       "      <td>上映时间：2001-12-12(法国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>98</td>\n",
       "      <td>千与千寻</td>\n",
       "      <td>主演：柊瑠美,周冬雨,入野自由</td>\n",
       "      <td>上映时间：2019-06-21</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>99</td>\n",
       "      <td>海上钢琴师</td>\n",
       "      <td>主演：蒂姆·罗斯,比尔·努恩,克兰伦斯·威廉姆斯三世</td>\n",
       "      <td>上映时间：2019-11-15</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>100</td>\n",
       "      <td>美丽人生</td>\n",
       "      <td>主演：罗伯托·贝尼尼,尼可莱塔·布拉斯基,乔治·坎塔里尼</td>\n",
       "      <td>上映时间：2020-01-03</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   rank_num     movie_name                                      actors            release_time score\n",
       "0         1           霸王别姬                               主演：张国荣,张丰毅,巩俐         上映时间：1993-07-26   9.5\n",
       "1         2         肖申克的救赎                      主演：蒂姆·罗宾斯,摩根·弗里曼,鲍勃·冈顿    上映时间：1994-09-10(加拿大)   9.5\n",
       "2         3        这个杀手不太冷                      主演：让·雷诺,加里·奥德曼,娜塔莉·波特曼     上映时间：1994-09-14(法国)   9.5\n",
       "3         4           罗马假日                    主演：格利高里·派克,奥黛丽·赫本,埃迪·艾伯特    上映时间：1953-08-20(意大利)   9.0\n",
       "4         5          泰坦尼克号                 主演：莱昂纳多·迪卡普里奥,凯特·温丝莱特,比利·赞恩         上映时间：1998-04-03   9.4\n",
       "5         6           乱世佳人                    主演：费雯·丽,克拉克·盖博,奥利维娅·德哈维兰     上映时间：1939-12-15(美国)   9.1\n",
       "6         7         唐伯虎点秋香                               主演：周星驰,巩俐,郑佩佩   上映时间：1993-07-01(中国香港)   9.1\n",
       "7         8           魂断蓝桥                      主演：费雯·丽,罗伯特·泰勒,露塞尔·沃特森     上映时间：1940-05-17(美国)   9.2\n",
       "8         9         辛德勒的名单                      主演：连姆·尼森,拉尔夫·费因斯,本·金斯利     上映时间：1993-11-30(美国)   9.2\n",
       "9        10           喜剧之王                              主演：周星驰,莫文蔚,张柏芝   上映时间：1999-02-13(中国香港)   9.1\n",
       "10       11           音乐之声                 主演：朱莉·安德鲁斯,克里斯托弗·普卢默,埃琳诺·帕克     上映时间：1965-03-02(美国)   9.0\n",
       "11       12           天空之城                           主演：寺田农,鹫尾真知子,龟山助清         上映时间：1992-05-01   9.0\n",
       "12       13           大闹天宫                               主演：邱岳峰,毕克,富润生         上映时间：1965-12-31   9.0\n",
       "13       14           春光乍泄                               主演：张国荣,梁朝伟,张震     上映时间：1997-05-17(法国)   9.2\n",
       "14       15         剪刀手爱德华                    主演：约翰尼·德普,薇诺娜·瑞德,黛安娜·威斯特     上映时间：1990-12-06(美国)   8.8\n",
       "15       16           黑客帝国                  主演：基努·里维斯,凯瑞-安·莫斯,劳伦斯·菲什伯恩         上映时间：2000-01-14   9.0\n",
       "16       17      指环王3：王者无敌                     主演：伊莱贾·伍德,伊恩·麦克莱恩,丽芙·泰勒         上映时间：2004-03-15   9.2\n",
       "17       18          加勒比海盗                    主演：约翰尼·德普,凯拉·奈特莉,奥兰多·布鲁姆         上映时间：2003-11-21   8.9\n",
       "18       19            教父2                     主演：阿尔·帕西诺,罗伯特·德尼罗,黛安·基顿     上映时间：1974-12-12(美国)   9.0\n",
       "19       20          楚门的世界                       主演：金·凯瑞,劳拉·琳妮,诺亚·艾默里奇         上映时间：1998(罗马尼亚)   8.9\n",
       "20       21            无间道                              主演：刘德华,梁朝伟,黄秋生         上映时间：2003-09-05   9.1\n",
       "21       22       蝙蝠侠：黑暗骑士                   主演：克里斯蒂安·贝尔,希斯·莱杰,阿伦·伊克哈特    上映时间：2008-07-14(阿根廷)   9.3\n",
       "22       23     射雕英雄传之东成西就                              主演：张国荣,梁朝伟,张学友   上映时间：1993-02-05(中国香港)   8.9\n",
       "23       24      指环王1：护戒使者                     主演：伊莱贾·伍德,伊恩·麦克莱恩,丽芙·泰勒         上映时间：2002-04-04   9.0\n",
       "24       25          天堂电影院               主演：菲利浦·诺瓦雷,赛尔乔·卡斯特利托,蒂兹亚娜·罗达托    上映时间：1988-11-17(意大利)   9.2\n",
       "25       26      指环王2：双塔奇兵                     主演：伊莱贾·伍德,伊恩·麦克莱恩,丽芙·泰勒         上映时间：2003-04-25   9.1\n",
       "26       27         机器人总动员                      主演：本·贝尔特,艾丽莎·奈特,杰夫·格尔林     上映时间：2008-06-27(美国)   9.3\n",
       "27       28             活着                                 主演：葛优,巩俐,牛犇     上映时间：1994-05-17(法国)   9.0\n",
       "28       29            狮子王               主演：马修·布罗德里克,尼基塔·卡兰姆,詹姆斯·厄尔·琼斯         上映时间：1995-07-15   8.8\n",
       "29       30         拯救大兵瑞恩                     主演：汤姆·汉克斯,马特·达蒙,汤姆·塞兹摩尔         上映时间：1998-11-13   8.9\n",
       "30       31           盗梦空间                主演：莱昂纳多·迪卡普里奥,渡边谦,约瑟夫·高登-莱维特         上映时间：2010-09-01   9.2\n",
       "31       32        忠犬八公的故事                        主演：Forest,理查·基尔,琼·艾伦     上映时间：2009-06-13(美国)   9.2\n",
       "32       33        哈尔的移动城堡                          主演：倍赏千惠子,木村拓哉,美轮明宏    上映时间：2004-09-05(意大利)   8.9\n",
       "33       34            阿凡达                 主演：萨姆·沃辛顿,佐伊·索尔达娜,米歇尔·罗德里格兹         上映时间：2010-01-04   9.0\n",
       "34       35          疯狂原始人                     主演：尼古拉斯·凯奇,艾玛·斯通,瑞安·雷诺兹         上映时间：2013-04-20   9.5\n",
       "35       36           十二怒汉                       主演：亨利·方达,李·科布,马丁·鲍尔萨姆     上映时间：1957-04-13(美国)   9.1\n",
       "36       37          搏击俱乐部              主演：爱德华·哈里森·诺顿,布拉德·皮特,海伦娜·伯翰·卡特    上映时间：1999-09-10(意大利)   8.8\n",
       "37       38           幽灵公主                          主演：松田洋治,石田百合子,田中裕子         上映时间：1998-05-01   8.9\n",
       "38       39          V字仇杀队                      主演：娜塔莉·波特曼,雨果·维文,斯蒂芬·瑞     上映时间：2005-12-11(美国)   8.8\n",
       "39       40         当幸福来敲门                      主演：威尔·史密斯,贾登·史密斯,坦迪·牛顿         上映时间：2008-01-17   8.9\n",
       "40       41         放牛班的春天                主演：热拉尔·朱尼奥,让-巴蒂斯特·莫尼耶,玛丽·布奈尔         上映时间：2004-10-16   8.8\n",
       "41       42           末代皇帝                             主演：尊龙,陈冲,彼得·奥图尔         上映时间：1987-10-23   8.8\n",
       "42       43      大话西游之月光宝盒                              主演：周星驰,莫文蔚,吴孟达         上映时间：2014-10-24   9.6\n",
       "43       44            风之谷                           主演：岛本须美,永井一郎,坂本千夏            上映时间：1992-05   8.8\n",
       "44       45          闻香识女人                 主演：阿尔·帕西诺,克里斯·奥唐纳,加布里埃尔·安瓦尔     上映时间：1992-12-23(美国)   8.8\n",
       "45       46        三傻大闹宝莱坞                          主演：阿米尔·汗,黄渤,卡琳娜·卡普         上映时间：2011-12-08   9.1\n",
       "46       47           勇敢的心                    主演：梅尔·吉布森,苏菲·玛索,帕特里克·麦高汉     上映时间：1995-05-18(美国)   8.8\n",
       "47       48         速度与激情5                        主演：范·迪塞尔,保罗·沃克,道恩·强森         上映时间：2011-05-12   9.2\n",
       "48       49           驯龙高手                 主演：杰伊·巴鲁切尔,杰拉德·巴特勒,亚美莉卡·费雷拉         上映时间：2010-05-14   9.0\n",
       "49       50     黑客帝国3：矩阵革命                     主演：基努·里维斯,雨果·维文,凯瑞-安·莫斯         上映时间：2003-11-05   8.8\n",
       "50       51          飞屋环游记                     主演：爱德华·阿斯纳,乔丹·长井,鲍勃·彼德森         上映时间：2009-08-04   8.9\n",
       "51       52           怦然心动                   主演：玛德琳·卡罗尔,卡兰·麦克奥利菲,艾丹·奎因     上映时间：2010-07-26(美国)   8.9\n",
       "52       53            断背山                   主演：希斯·莱杰,杰克·吉伦哈尔,米歇尔·威廉姆斯    上映时间：2005-09-02(意大利)   8.9\n",
       "53       54       少年派的奇幻漂流                          主演：苏拉·沙玛,伊尔凡·可汗,塔布         上映时间：2012-11-22   9.0\n",
       "54       55           神偷奶爸                   主演：史蒂夫·卡瑞尔,杰森·席格尔,拉塞尔·布兰德    上映时间：2010-06-20(俄罗斯)   8.9\n",
       "55       56           致命魔术                    主演：休·杰克曼,克里斯蒂安·贝尔,迈克尔·凯恩    上映时间：2006-10-17(意大利)   8.8\n",
       "56       57          无敌破坏王                     主演：约翰·C·赖利,萨拉·西尔弗曼,简·林奇         上映时间：2012-11-06   9.1\n",
       "57       58           鬼子来了                                主演：姜文,姜宏波,陈强     上映时间：2000-05-13(法国)   8.9\n",
       "58       59           美丽心灵                     主演：罗素·克洛,詹妮弗·康纳利,艾德·哈里斯     上映时间：2001-12-13(美国)   8.8\n",
       "59       60     蝙蝠侠：黑暗骑士崛起                   主演：克里斯蒂安·贝尔,迈克尔·凯恩,加里·奥德曼         上映时间：2012-08-27   8.9\n",
       "60       61            甜蜜蜜                               主演：黎明,张曼玉,曾志伟         上映时间：2015-02-13   9.2\n",
       "61       62  哈利·波特与死亡圣器（下）                 主演：丹尼尔·雷德克里夫,鲁伯特·格林特,艾玛·沃特森         上映时间：2011-08-04   9.0\n",
       "62       63           倩女幽魂                               主演：张国荣,王祖贤,午马         上映时间：2011-04-30   9.2\n",
       "63       64          夜访吸血鬼                   主演：汤姆·克鲁斯,布拉德·皮特,克尔斯滕·邓斯特     上映时间：1994-11-11(美国)   8.8\n",
       "64       65       本杰明·巴顿奇事                  主演：布拉德·皮特,凯特·布兰切特,塔拉吉·P·汉森     上映时间：2008-12-25(美国)   8.8\n",
       "65       66            钢琴家             主演：艾德里安·布洛迪,艾米丽雅·福克斯,米哈乌·热布罗夫斯基     上映时间：2002-05-24(法国)   8.8\n",
       "66       67           触不可及                      主演：弗朗索瓦·克鲁塞,奥玛·希,安娜·勒尼     上映时间：2011-11-02(法国)   9.1\n",
       "67       68            小鞋子  主演：默罕默德·阿米尔·纳吉,Kamal Mirkarimi,Behzad Rafi           上映时间：1997(伊朗)   9.0\n",
       "68       69          新龙门客栈                              主演：张曼玉,梁家辉,甄子丹         上映时间：2012-02-24   8.8\n",
       "69       70      大话西游之大圣娶亲                               主演：周星驰,朱茵,莫文蔚         上映时间：2014-10-24   8.8\n",
       "70       71         初恋这件小事            主演：马里奥·毛瑞尔,平采娜·乐维瑟派布恩,阿查拉那·阿瑞亚卫考         上映时间：2012-06-05   8.8\n",
       "71       72             熔炉                               主演：孔刘,郑有美,金智英     上映时间：2011-09-22(韩国)   8.8\n",
       "72       73             素媛                               主演：李来,薛耿求,严志媛     上映时间：2013-10-02(韩国)   9.0\n",
       "73       74           萤火之森                           主演：内山昂辉,佐仓绫音,后藤弘树     上映时间：2011-09-17(日本)   9.0\n",
       "74       75       穿条纹睡衣的男孩                   主演：阿沙·巴特菲尔德,维拉·法梅加,大卫·休里斯     上映时间：2008-08-28(英国)   9.0\n",
       "75       76             教父                     主演：马龙·白兰度,阿尔·帕西诺,詹姆斯·肯恩         上映时间：2015-04-18   9.3\n",
       "76       77           窃听风暴                 主演：乌尔里希·穆埃,塞巴斯蒂安·科赫,马蒂娜·格德克     上映时间：2006-03-23(德国)   9.0\n",
       "77       78         7号房的礼物                              主演：柳承龙,郑镇荣,朴信惠     上映时间：2013-01-23(韩国)   8.9\n",
       "78       79          时空恋旅人                  主演：瑞秋·麦克亚当斯,多姆纳尔·格里森,比尔·奈伊     上映时间：2013-09-04(英国)   8.8\n",
       "79       80     借东西的小人阿莉埃蒂                           主演：志田未来,神木隆之介,大竹忍     上映时间：2010-07-17(日本)   8.8\n",
       "80       81           恐怖直播                              主演：河正宇,李璟荣,李大为     上映时间：2013-07-31(韩国)   8.8\n",
       "81       82           英雄本色                               主演：狄龙,张国荣,周润发         上映时间：2017-11-17   9.2\n",
       "82       83            海豚湾                     主演：里克·奥巴瑞,路易·西霍尤斯,哈迪·琼斯     上映时间：2009-07-31(美国)   8.9\n",
       "83       84         忠犬八公物语                          主演：仲代达矢,春川真澄,井川比佐志     上映时间：1987-08-01(日本)   9.0\n",
       "84       85            辩护人                              主演：宋康昊,郭度沅,吴达洙     上映时间：2013-12-18(韩国)   8.8\n",
       "85       86          完美的世界                 主演：凯文·科斯特纳,克林特·伊斯特伍德,T·J·劳瑟     上映时间：1993-11-24(美国)   8.9\n",
       "86       87           上帝之城            主演：亚历桑德雷·罗德里格斯,艾莉丝·布拉加,莱安德鲁·菲尔米诺  上映时间：2002-05-18(戛纳电影节)   8.9\n",
       "87       88           美国往事                  主演：罗伯特·德尼罗,詹姆斯·伍兹,伊丽莎白·麦戈文         上映时间：2015-04-23   9.1\n",
       "88       89            七武士                             主演：三船敏郎,志村乔,千秋实     上映时间：1954-04-26(日本)   9.1\n",
       "89       90             一一                              主演：吴念真,金燕玲,李凯莉     上映时间：2000-05-15(法国)   8.9\n",
       "90       91             龙猫                             主演：秦岚,糸井重里,岛本须美         上映时间：2018-12-14   9.1\n",
       "91       92           爱·回家                              主演：俞承豪,金艺芬,童孝熙     上映时间：2002-04-05(韩国)   9.0\n",
       "92       93           阿飞正传                              主演：张国荣,张曼玉,刘德华         上映时间：2018-06-25   8.8\n",
       "93       94            我爱你                              主演：宋在浩,李顺才,尹秀晶     上映时间：2011-02-17(韩国)   9.0\n",
       "94       95          黄金三镖客                 主演：克林特·伊斯特伍德,李·范·克里夫,埃里·瓦拉赫    上映时间：1966-12-23(意大利)   8.9\n",
       "95       96             海洋                         主演：雅克·贝汉,姜文,兰斯洛特·佩林         上映时间：2011-08-12   8.9\n",
       "96       97           迁徙的鸟                     主演：雅克·贝汉,Philippe Labro     上映时间：2001-12-12(法国)   9.1\n",
       "97       98           千与千寻                             主演：柊瑠美,周冬雨,入野自由         上映时间：2019-06-21   9.3\n",
       "98       99          海上钢琴师                  主演：蒂姆·罗斯,比尔·努恩,克兰伦斯·威廉姆斯三世         上映时间：2019-11-15   9.3\n",
       "99      100           美丽人生                主演：罗伯托·贝尼尼,尼可莱塔·布拉斯基,乔治·坎塔里尼         上映时间：2020-01-03   9.3"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 导入包\n",
    "import pandas as pd \n",
    "import requests\n",
    "import re\n",
    "import parsel\n",
    "from fake_useragent import UserAgent\n",
    "pd.set_option('display.max_rows', 500)\n",
    "\n",
    "def get_one_paeg(url):\n",
    "    '''功能：给定URL，获取猫眼top一页信息''' \n",
    "    headers = {'user-agent': UserAgent().random} \n",
    "    # 发起请求\n",
    "    r = requests.get(url, headers=headers) \n",
    "    # 解析数据\n",
    "    html = parsel.Selector(r.text) \n",
    "\n",
    "    # 获取数据\n",
    "    rank_num = html.xpath('//dd/i/text()').extract()\n",
    "    movie_name = html.xpath('//dd//p[@class=\"name\"]/a/text()').extract()\n",
    "    actors = [i.strip() for i in html.xpath('//dd//p[@class=\"star\"]/text()').extract()]\n",
    "    release_time = html.xpath('//dd//p[@class=\"releasetime\"]/text()').extract()\n",
    "    score = [''.join(re.findall(r' class=\"integer\">(.*?)</i><i class=\"fraction\">(.*?)</i></p>', i)[0])\n",
    "             for i in html.xpath('//dd//p[@class=\"score\"]').extract()]\n",
    "    \n",
    "    # 存储数据\n",
    "    df = pd.DataFrame({'rank_num': rank_num,\n",
    "                       'movie_name': movie_name,\n",
    "                       'actors': actors,\n",
    "                       'release_time': release_time,\n",
    "                       'score': score\n",
    "                          })\n",
    "    return df\n",
    "\n",
    "def get_10_page():\n",
    "    '''功能：给定URL，获取猫眼top100信息''' \n",
    "    df_all = pd.DataFrame()\n",
    "    \n",
    "    for i in range(10):\n",
    "        url = 'https://maoyan.com/board/4?offset={}'.format(i*10)\n",
    "        df_one = get_one_paeg(url)\n",
    "        df_all = df_all.append(df_one, ignore_index=True)\n",
    "\n",
    "    return df_all\n",
    "\n",
    "\n",
    "df_all = get_10_page()\n",
    "df_all.to_csv('maoyan.csv', index=False) \n",
    "df_all"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据处理\n",
    "\n",
    "你可以利用 Python 处理数据，尤其是海量数据，Excel 打开都困难的，EXCEL 2016最多是104856行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据可视化\n",
    "\n",
    "你可以利用 Python 将数据转化成图，更加形象生动。\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/Users/davidfnck/Downloads/All-Lessons/Python Tutorial for Humans™/013-Python 直播课/南丁格尔玫瑰图.html'"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 使用pyecharts绘制南丁格尔玫瑰图\n",
    "\n",
    "# 导入包\n",
    "from pyecharts.charts import Pie\n",
    "from pyecharts import options as opts\n",
    "\n",
    "# 准备数据：省份和对应的连续多日疫情零新增数量、颜色序列\n",
    "provinces = ['西藏', '澳门', '青海', '贵州', '新疆',\n",
    "             '江苏', '内蒙古', '陕西', '海南', '云南',\n",
    "             '吉林', '山西', '重庆', '广西', '福建',\n",
    "             '江西', '安徽', '河北', '天津', '湖南',\n",
    "             '辽宁', '宁夏', '浙江', '四川', '上海',\n",
    "             '黑龙江', '北京']\n",
    "number = [42, 37, 35, 24, 23, 22, 22, 21, 21, 20, 17, 16, 16,\n",
    "       16, 14, 13, 13, 13, 13, 12, 9, 8, 7, 7, 1, 1, 1]\n",
    "color_series = ['#FAE927','#E9E416','#C9DA36','#9ECB3C','#6DBC49',\n",
    "              '#37B44E','#3DBA78','#14ADCF','#209AC9','#1E91CA',\n",
    "              '#2C6BA0','#2B55A1','#2D3D8E','#44388E','#6A368B'\n",
    "              '#7D3990','#A63F98','#C31C88','#D52178','#D5225B',\n",
    "              '#D02C2A','#D44C2D','#F57A34','#FA8F2F','#D99D21',\n",
    "              '#CF7B25','#CF7B25','#CF7B25']\n",
    "\n",
    "# 创建饼图\n",
    "pie = Pie(init_opts=opts.InitOpts(width='1350px', height='750px'))\n",
    "\n",
    "# 添加数据\n",
    "pie.add(\"\", [list(z) for z in zip(provinces, number)],\n",
    "        radius=[\"30%\", \"135%\"],\n",
    "        center=[\"50%\", \"65%\"],\n",
    "        rosetype=\"area\"\n",
    "        )\n",
    "\n",
    "# 设置全局配置\n",
    "pie.set_global_opts(title_opts=opts.TitleOpts(title='\\t\\t\\t\\t\\t\\t\\t多省市\\n确诊病例连续多日',\n",
    "                                              subtitle='\\t\\t\\t零新增',\n",
    "                                              pos_left='42.5%', pos_right='50%',\n",
    "                                              pos_top='60%', pos_bottom='50%',\n",
    "                                              title_textstyle_opts=opts.TextStyleOpts(font_size=25),\n",
    "                                              subtitle_textstyle_opts=opts.TextStyleOpts(font_size=30,\n",
    "                                                                                         font_family='monospace',\n",
    "                                                                                         font_style='normal',\n",
    "                                                                                         background_color='red',\n",
    "                                                                                         rich={'color': 'red'})\n",
    "                                              ),\n",
    "                    legend_opts=opts.LegendOpts(is_show=False)\n",
    "                   )\n",
    "\n",
    "# 设置系列配置和颜色\n",
    "pie.set_series_opts(label_opts=opts.LabelOpts(\n",
    "                    is_show=True, position=\"inside\", font_size=12,\n",
    "                    formatter=\"{b}:{c}天\", font_style=\"italic\",\n",
    "                    font_weight=\"bold\", font_family=\"Microsoft YaHei\"\n",
    "                                              )\n",
    "                    )\n",
    "\n",
    "pie.set_colors(color_series)\n",
    "\n",
    "# 在网页生成图片\n",
    "pie.render('南丁格尔玫瑰图.html') "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据挖掘\n",
    "\n",
    "你可以利用 Python 从数据中找到更深层次的信息。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 2.42.3 (20191010.1750)\n",
       " -->\n",
       "<!-- Title: Tree Pages: 1 -->\n",
       "<svg width=\"564pt\" height=\"414pt\"\n",
       " viewBox=\"0.00 0.00 563.83 414.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 410)\">\n",
       "<title>Tree</title>\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-410 559.83,-410 559.83,4 -4,4\"/>\n",
       "<!-- 0 -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>0</title>\n",
       "<path fill=\"#ffffff\" stroke=\"black\" d=\"M271.53,-406C271.53,-406 124.23,-406 124.23,-406 118.23,-406 112.23,-400 112.23,-394 112.23,-394 112.23,-340 112.23,-340 112.23,-334 118.23,-328 124.23,-328 124.23,-328 271.53,-328 271.53,-328 277.53,-328 283.53,-334 283.53,-340 283.53,-340 283.53,-394 283.53,-394 283.53,-400 277.53,-406 271.53,-406\"/>\n",
       "<text text-anchor=\"middle\" x=\"197.88\" y=\"-390.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal length (cm) &lt;= 2.45</text>\n",
       "<text text-anchor=\"middle\" x=\"197.88\" y=\"-376.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 1.585</text>\n",
       "<text text-anchor=\"middle\" x=\"197.88\" y=\"-362.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 150</text>\n",
       "<text text-anchor=\"middle\" x=\"197.88\" y=\"-348.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [50, 50, 50]</text>\n",
       "<text text-anchor=\"middle\" x=\"197.88\" y=\"-334.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = setosa</text>\n",
       "</g>\n",
       "<!-- 1 -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>1</title>\n",
       "<path fill=\"#e58139\" stroke=\"black\" d=\"M165.78,-285C165.78,-285 69.97,-285 69.97,-285 63.97,-285 57.97,-279 57.97,-273 57.97,-273 57.97,-233 57.97,-233 57.97,-227 63.97,-221 69.97,-221 69.97,-221 165.78,-221 165.78,-221 171.78,-221 177.78,-227 177.78,-233 177.78,-233 177.78,-273 177.78,-273 177.78,-279 171.78,-285 165.78,-285\"/>\n",
       "<text text-anchor=\"middle\" x=\"117.88\" y=\"-269.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.0</text>\n",
       "<text text-anchor=\"middle\" x=\"117.88\" y=\"-255.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 50</text>\n",
       "<text text-anchor=\"middle\" x=\"117.88\" y=\"-241.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [50, 0, 0]</text>\n",
       "<text text-anchor=\"middle\" x=\"117.88\" y=\"-227.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = setosa</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;1 -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>0&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M170.57,-327.77C162.63,-316.66 153.96,-304.51 145.97,-293.33\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"148.69,-291.11 140.03,-285.01 142.99,-295.18 148.69,-291.11\"/>\n",
       "<text text-anchor=\"middle\" x=\"135.92\" y=\"-305.47\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">True</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>2</title>\n",
       "<path fill=\"#ffffff\" stroke=\"black\" d=\"M350.06,-292C350.06,-292 207.69,-292 207.69,-292 201.69,-292 195.69,-286 195.69,-280 195.69,-280 195.69,-226 195.69,-226 195.69,-220 201.69,-214 207.69,-214 207.69,-214 350.06,-214 350.06,-214 356.06,-214 362.06,-220 362.06,-226 362.06,-226 362.06,-280 362.06,-280 362.06,-286 356.06,-292 350.06,-292\"/>\n",
       "<text text-anchor=\"middle\" x=\"278.88\" y=\"-276.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal width (cm) &lt;= 1.75</text>\n",
       "<text text-anchor=\"middle\" x=\"278.88\" y=\"-262.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 1.0</text>\n",
       "<text text-anchor=\"middle\" x=\"278.88\" y=\"-248.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 100</text>\n",
       "<text text-anchor=\"middle\" x=\"278.88\" y=\"-234.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 50, 50]</text>\n",
       "<text text-anchor=\"middle\" x=\"278.88\" y=\"-220.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = versicolor</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;2 -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>0&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M225.53,-327.77C231.91,-318.94 238.77,-309.45 245.38,-300.32\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"248.33,-302.21 251.35,-292.06 242.66,-298.11 248.33,-302.21\"/>\n",
       "<text text-anchor=\"middle\" x=\"255.32\" y=\"-312.54\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">False</text>\n",
       "</g>\n",
       "<!-- 3 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>3</title>\n",
       "<path fill=\"#4de88e\" stroke=\"black\" d=\"M257.53,-178C257.53,-178 110.23,-178 110.23,-178 104.23,-178 98.23,-172 98.23,-166 98.23,-166 98.23,-112 98.23,-112 98.23,-106 104.23,-100 110.23,-100 110.23,-100 257.53,-100 257.53,-100 263.53,-100 269.53,-106 269.53,-112 269.53,-112 269.53,-166 269.53,-166 269.53,-172 263.53,-178 257.53,-178\"/>\n",
       "<text text-anchor=\"middle\" x=\"183.88\" y=\"-162.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal length (cm) &lt;= 4.95</text>\n",
       "<text text-anchor=\"middle\" x=\"183.88\" y=\"-148.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.445</text>\n",
       "<text text-anchor=\"middle\" x=\"183.88\" y=\"-134.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 54</text>\n",
       "<text text-anchor=\"middle\" x=\"183.88\" y=\"-120.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 49, 5]</text>\n",
       "<text text-anchor=\"middle\" x=\"183.88\" y=\"-106.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = versicolor</text>\n",
       "</g>\n",
       "<!-- 2&#45;&gt;3 -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>2&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M246.45,-213.77C238.81,-204.76 230.58,-195.06 222.69,-185.76\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"225.3,-183.42 216.16,-178.06 219.96,-187.95 225.3,-183.42\"/>\n",
       "</g>\n",
       "<!-- 6 -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>6</title>\n",
       "<path fill=\"#843de6\" stroke=\"black\" d=\"M447.53,-178C447.53,-178 300.23,-178 300.23,-178 294.23,-178 288.23,-172 288.23,-166 288.23,-166 288.23,-112 288.23,-112 288.23,-106 294.23,-100 300.23,-100 300.23,-100 447.53,-100 447.53,-100 453.53,-100 459.53,-106 459.53,-112 459.53,-112 459.53,-166 459.53,-166 459.53,-172 453.53,-178 447.53,-178\"/>\n",
       "<text text-anchor=\"middle\" x=\"373.88\" y=\"-162.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal length (cm) &lt;= 4.85</text>\n",
       "<text text-anchor=\"middle\" x=\"373.88\" y=\"-148.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.151</text>\n",
       "<text text-anchor=\"middle\" x=\"373.88\" y=\"-134.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 46</text>\n",
       "<text text-anchor=\"middle\" x=\"373.88\" y=\"-120.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 1, 45]</text>\n",
       "<text text-anchor=\"middle\" x=\"373.88\" y=\"-106.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\n",
       "</g>\n",
       "<!-- 2&#45;&gt;6 -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>2&#45;&gt;6</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M311.31,-213.77C318.95,-204.76 327.17,-195.06 335.06,-185.76\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"337.8,-187.95 341.6,-178.06 332.46,-183.42 337.8,-187.95\"/>\n",
       "</g>\n",
       "<!-- 4 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>4</title>\n",
       "<path fill=\"#3de684\" stroke=\"black\" d=\"M111.63,-64C111.63,-64 12.12,-64 12.12,-64 6.12,-64 0.12,-58 0.12,-52 0.12,-52 0.12,-12 0.12,-12 0.12,-6 6.12,0 12.12,0 12.12,0 111.63,0 111.63,0 117.63,0 123.63,-6 123.63,-12 123.63,-12 123.63,-52 123.63,-52 123.63,-58 117.63,-64 111.63,-64\"/>\n",
       "<text text-anchor=\"middle\" x=\"61.88\" y=\"-48.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.146</text>\n",
       "<text text-anchor=\"middle\" x=\"61.88\" y=\"-34.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 48</text>\n",
       "<text text-anchor=\"middle\" x=\"61.88\" y=\"-20.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 47, 1]</text>\n",
       "<text text-anchor=\"middle\" x=\"61.88\" y=\"-6.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = versicolor</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;4 -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>3&#45;&gt;4</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M139.49,-99.8C128.52,-90.36 116.78,-80.25 105.84,-70.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"107.9,-67.99 98.03,-64.12 103.33,-73.29 107.9,-67.99\"/>\n",
       "</g>\n",
       "<!-- 5 -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>5</title>\n",
       "<path fill=\"#c09cf2\" stroke=\"black\" d=\"M244.58,-64C244.58,-64 153.17,-64 153.17,-64 147.17,-64 141.17,-58 141.17,-52 141.17,-52 141.17,-12 141.17,-12 141.17,-6 147.17,0 153.17,0 153.17,0 244.58,0 244.58,0 250.58,0 256.58,-6 256.58,-12 256.58,-12 256.58,-52 256.58,-52 256.58,-58 250.58,-64 244.58,-64\"/>\n",
       "<text text-anchor=\"middle\" x=\"198.88\" y=\"-48.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.918</text>\n",
       "<text text-anchor=\"middle\" x=\"198.88\" y=\"-34.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 6</text>\n",
       "<text text-anchor=\"middle\" x=\"198.88\" y=\"-20.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 2, 4]</text>\n",
       "<text text-anchor=\"middle\" x=\"198.88\" y=\"-6.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;5 -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>3&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M189.34,-99.8C190.53,-91.46 191.79,-82.6 193,-74.15\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"196.48,-74.51 194.43,-64.12 189.55,-73.52 196.48,-74.51\"/>\n",
       "</g>\n",
       "<!-- 7 -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>7</title>\n",
       "<path fill=\"#c09cf2\" stroke=\"black\" d=\"M405.58,-64C405.58,-64 314.17,-64 314.17,-64 308.17,-64 302.17,-58 302.17,-52 302.17,-52 302.17,-12 302.17,-12 302.17,-6 308.17,0 314.17,0 314.17,0 405.58,0 405.58,0 411.58,0 417.58,-6 417.58,-12 417.58,-12 417.58,-52 417.58,-52 417.58,-58 411.58,-64 405.58,-64\"/>\n",
       "<text text-anchor=\"middle\" x=\"359.88\" y=\"-48.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.918</text>\n",
       "<text text-anchor=\"middle\" x=\"359.88\" y=\"-34.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 3</text>\n",
       "<text text-anchor=\"middle\" x=\"359.88\" y=\"-20.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 1, 2]</text>\n",
       "<text text-anchor=\"middle\" x=\"359.88\" y=\"-6.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\n",
       "</g>\n",
       "<!-- 6&#45;&gt;7 -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>6&#45;&gt;7</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M368.78,-99.8C367.67,-91.46 366.49,-82.6 365.36,-74.15\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"368.82,-73.57 364.03,-64.12 361.88,-74.49 368.82,-73.57\"/>\n",
       "</g>\n",
       "<!-- 8 -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>8</title>\n",
       "<path fill=\"#8139e5\" stroke=\"black\" d=\"M543.78,-64C543.78,-64 447.97,-64 447.97,-64 441.97,-64 435.97,-58 435.97,-52 435.97,-52 435.97,-12 435.97,-12 435.97,-6 441.97,0 447.97,0 447.97,0 543.78,0 543.78,0 549.78,0 555.78,-6 555.78,-12 555.78,-12 555.78,-52 555.78,-52 555.78,-58 549.78,-64 543.78,-64\"/>\n",
       "<text text-anchor=\"middle\" x=\"495.88\" y=\"-48.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.0</text>\n",
       "<text text-anchor=\"middle\" x=\"495.88\" y=\"-34.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 43</text>\n",
       "<text text-anchor=\"middle\" x=\"495.88\" y=\"-20.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 0, 43]</text>\n",
       "<text text-anchor=\"middle\" x=\"495.88\" y=\"-6.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\n",
       "</g>\n",
       "<!-- 6&#45;&gt;8 -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>6&#45;&gt;8</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M418.27,-99.8C429.23,-90.36 440.97,-80.25 451.92,-70.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"454.43,-73.29 459.72,-64.12 449.86,-67.99 454.43,-73.29\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.files.Source at 0x127d32c10>"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.datasets import load_iris\n",
    "from sklearn import tree\n",
    "import graphviz\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "\n",
    "iris = load_iris()\n",
    "\n",
    "# 建立决策树\n",
    "clf = DecisionTreeClassifier(criterion='entropy', max_depth=3) \n",
    "clf = clf.fit(iris.data, iris.target)\n",
    "\n",
    "# 可视化\n",
    "# 决策树可视化\n",
    "dot_data = tree.export_graphviz(decision_tree=clf,\n",
    "                                 out_file=None, \n",
    "                                 feature_names=iris.feature_names,\n",
    "                                 class_names=iris.target_names, \n",
    "                                 filled=True,\n",
    "                                 rounded=True\n",
    "                                )\n",
    "graph = graphviz.Source(dot_data)\n",
    "graph"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 自动化办公：一样的工作，你要花1小时，我只要 10 秒钟"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A公司合同完成\n",
      "B公司合同完成\n",
      "C公司合同完成\n",
      "D公司合同完成\n",
      "E公司合同完成\n",
      "F公司合同完成\n",
      "G公司合同完成\n",
      "H公司合同完成\n",
      "I公司合同完成\n",
      "J公司合同完成\n",
      "K公司合同完成\n",
      "L公司合同完成\n",
      "M公司合同完成\n",
      "N公司合同完成\n",
      "O公司合同完成\n",
      "P公司合同完成\n",
      "Q公司合同完成\n",
      "R公司合同完成\n"
     ]
    }
   ],
   "source": [
    "from docx import Document\n",
    "import xlrd\n",
    "\n",
    "\n",
    "def change_text(old_text, new_text):\n",
    "    all_paragraphs = document.paragraphs\n",
    "    for paragraph in all_paragraphs:\n",
    "        for run in paragraph.runs:\n",
    "            run_text = run.text.replace(old_text, new_text)\n",
    "            run.text = run_text\n",
    "\n",
    "    all_tables = document.tables\n",
    "    for table in all_tables:\n",
    "        for row in table.rows:\n",
    "            for cell in row.cells:\n",
    "                cell_text = cell.text.replace(old_text, new_text)\n",
    "                cell.text = cell_text\n",
    "\n",
    "\n",
    "xlsx = xlrd.open_workbook('Excel_Files/合同信息表.xlsx')\n",
    "sheet = xlsx.sheet_by_index(0)\n",
    "\n",
    "for table_row in range(1, sheet.nrows):\n",
    "    document = Document(\"Word_Files/修改模板.docx\")\n",
    "    for table_col in range(0, sheet.ncols):\n",
    "        change_text(str(sheet.cell_value(0, table_col)), str(sheet.cell_value(table_row, table_col)))\n",
    "\n",
    "    document.save(\"Word_Files/%s合同.docx\" % str(sheet.cell_value(table_row, 2)))\n",
    "    print(\"%s合同完成\" % str(sheet.cell_value(table_row, 2)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Python 安装\n",
    "\n",
    "https://www.anaconda.com/\n",
    "\n",
    "[文字版教程](https://github.com/imcda/Python-Tutorial-for-Humans/blob/master/002-%E5%AE%89%E8%A3%85%20Python/001-Anaconda%20%E5%AE%89%E8%A3%85%E5%8F%8A%E6%93%8D%E4%BD%9C.md)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Python 环境和包的管理\n",
    "\n",
    "[文字版教程](https://github.com/imcda/Python-Tutorial-for-Humans/blob/master/002-%E5%AE%89%E8%A3%85%20Python/001-Anaconda%20%E5%AE%89%E8%A3%85%E5%8F%8A%E6%93%8D%E4%BD%9C.md)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Python 编程工具\n",
    "\n",
    "[文字版教程](https://github.com/imcda/Python-Tutorial-for-Humans/blob/master/002-%E5%AE%89%E8%A3%85%20Python/002-Jupyter%20Notebook%20%E6%95%99%E7%A8%8B.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:root] *",
   "language": "python",
   "name": "conda-root-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
